//
//  ScrollView.m
//  10-10
//
//  Created by 钟纪旺 on 16/11/30.
//  Copyright © 2016年 zjw. All rights reserved.
//

#import "ScrollView.h"

@interface ScrollView ()
@property (weak, nonatomic) IBOutlet UIScrollView *scrool;

@end

@implementation ScrollView

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    for(int i = 0; i < self.images.count; i++)
    {
        UIImageView *imageVi = [[UIImageView alloc] initWithFrame:CGRectMake(self.view.frame.size.width * i, 0, self.view.frame.size.width, self.view.frame.size.height)];
        imageVi.image = self.images[i];
        imageVi.userInteractionEnabled = YES;
        
        UITapGestureRecognizer *tapRecon = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTap)];
        [imageVi addGestureRecognizer:tapRecon];
        
        [self.scrool addSubview:imageVi];
    }
    self.scrool.contentSize = CGSizeMake(self.view.frame.size.width * self.images.count, self.view.frame.size.height);
}
- (void)onTap
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
